package com.program.common;

/**
 * @ProjectName: FastProject
 * @ClassName: ResultData
 * @Author: Joe
 * @CreateDate: 2021/5/20 2:47 下午
 * @Version: 1.0.0
 */
public class ResultData {

    private int code=0;
    private String message="success";
    private Object data;

    public ResultData(){}

    public ResultData(int code, String message){
        this.code=code;
        this.message=message;
    }

    public ResultData(Object data){
        this.data=data;
    }

    public static ResultData  success(){
        return new ResultData();
    }

    public static ResultData  success(Object data){
        return new ResultData(data);
    }

    public static ResultData  failed(int code,String message){
        return new ResultData(code,message);
    }

    public static ResultData  failed(){
        return new ResultData(ResultConstants.FAILEDS_CODE,"error");
    }

    public static ResultData  failed(String message){
        return new ResultData(ResultConstants.FAILEDS_CODE,message);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
